package com.coder.oj.system.controller;

import com.coder.oj.common.core.JwtToken;
import com.coder.oj.common.core.R;
import com.coder.oj.common.mapper.CaseMapper;
import com.coder.oj.system.mapstruct.CaseMapstruct;
import com.coder.oj.system.vo.CaseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Bosen 2022/11/25 15:52
 **/
@Api(tags = {"样例管理"})
@RestController
@RequestMapping("/case")
public class CaseController {

    @Autowired
    private CaseMapper caseMapper;

    @Autowired
    private CaseMapstruct caseMapstruct;

    @JwtToken
    @ApiOperation("样例详情")
    @GetMapping
    public R<CaseVo> getCaseById(@RequestParam("id") Long id) {
        return R.ok().setResult(caseMapstruct.toVO(caseMapper.selectById(id)));
    }

}
